<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition  xmlns="http://www.w3.org/1999/xhtml"
                 xmlns:ui="http://java.sun.com/jsf/facelets"
                 xmlns:f="http://java.sun.com/jsf/core"
                 xmlns:h="http://java.sun.com/jsf/html"
                 xmlns:c="http://java.sun.com/jsp/jstl/core"
                 xmlns:pou="http://primefaces.org/ui"> 
    <c:set var="tot1" value="${0}" />
    <c:set var="tot2" value="${0}" />
    <c:set var="tot3" value="${0}" />
    <c:set var="tot4" value="${0}" />
    <c:set var="tot5" value="${0}" />
    <c:set var="tot6" value="${0}" />
    <c:forEach var="r" items="${mbSummary.clientes8020}">
        <c:set var="tot1" value="${tot1 + r.deuda131}" />
        <c:set var="tot2" value="${tot2 + r.deuda3061}" />
        <c:set var="tot3" value="${tot3 + r.deuda6091}" />
        <c:set var="tot4" value="${tot4 + r.deuda90181}" />
        <c:set var="tot5" value="${tot5 + r.deuda181mas}" />
        <c:set var="tot6" value="${tot6 + r.granTotal}" />
    </c:forEach>
    <h:panelGrid columns="2">
        <pou:button onclick="return topdfEl('micreditform:panelDetalleData:reporte8020',180,100);" 
                                            icon="ui-icon-print" value="PDF"></pou:button>
        <pou:commandButton ajax="false" icon="ui-icon-arrowthick-1-s" value="EXCEL" >  
            <pou:dataExporter type="xls" target="tlb8020" fileName="report" />  
        </pou:commandButton>
    </h:panelGrid>
    <h:panelGrid id="reporte8020">
        <pou:dataTable id="tlb8020" rows="20" value="#{mbSummary.clientes8020}" var="c" >
            <f:facet name="header">Reporte 80/20</f:facet>
            <pou:column sortBy="#{c.cliente}" headerText="Id">
                <h:outputText value="#{c.cliente}" />
            </pou:column>
            <pou:column sortBy="#{c.nombre}" headerText="Nombre">
                <h:outputText value="#{c.nombre}" />
            </pou:column>
            <pou:column styleClass="colMontos" sortBy="#{c.deuda131}" headerText="1 a 30 dias">
                <h:outputText value="#{c.deuda131}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot1}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
            <pou:column styleClass="colMontos" sortBy="#{c.deuda3061}" headerText="31 a 60 dias">
                <h:outputText value="#{c.deuda3061}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot2}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
            <pou:column styleClass="colMontos" sortBy="#{c.deuda6091}" headerText="61 a 90 dias">
                <h:outputText value="#{c.deuda6091}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot3}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
            <pou:column styleClass="colMontos" sortBy="#{c.deuda90181}" headerText="91 a 180 dias">
                <h:outputText value="#{c.deuda90181}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot4}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
            <pou:column styleClass="colMontos" sortBy="#{c.deuda181mas}" headerText="181 dias o mas">
                <h:outputText value="#{c.deuda181mas}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot5}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
            <pou:column styleClass="colMontos" headerText="Grand Total">
                <h:outputText value="#{c.granTotal}" >
                    <f:convertNumber maxFractionDigits="2" />
                </h:outputText>
                <f:facet name="footer">
                    <h:outputText value="#{tot6}" >
                        <f:convertNumber maxFractionDigits="2" />
                    </h:outputText>
                </f:facet>
            </pou:column>
        </pou:dataTable>
    </h:panelGrid>
</ui:composition>
